<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">

<title>附近医疗</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style type="text/css">
body,html,#allmap {
	width: 100%;
	height: 100%;
	margin: 0;
	font-family: "微软雅黑";
}

#l-map {
	height: 50%;
	width: 100%;
}

#r-result {
	width: 100%;
	height: 40%;
	overflow: scroll;
}

#r-result div p{
	padding: 5px !important;
}
</style>

</head>
<script type="text/javascript" src="<%=basePath%>js/jquery.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=A0YwaB4T30OXQu1KN3RVGiQgnakCvymn"></script>
<body>
	<div id="l-map"></div>
	<div id="r-result" ></div>
	<footer style="text-align: center;height: 40px;padding-top: 11px;background-color: #337ab7" onclick="toCondition()">
		<a href="./jsp/conditionsList.jsp" style="color: #fff;">返回</a>
	</footer>
</body>

<script type="text/javascript">
var lng = getUrlParam("lng");
var lat = getUrlParam("lat");

var map = new BMap.Map("l-map");            // 创建Map实例
map.centerAndZoom(new BMap.Point(lng, lat), 16);
var myKeys = ["药店", "医院","门诊","诊所","药房"];
var local = new BMap.LocalSearch(map, {
	renderOptions:{map: map, panel:"r-result"},
	pageCapacity:5
});
local.searchInBounds(myKeys, map.getBounds());

function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return  decodeURI(r[2]); return null;
}

function toCondition(){
	window.location.href="./jsp/conditionsList.jsp";
}
</script>
</html>
